using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using DataAccess;
using DataTransferObject;

namespace Business
{

    public enum LoaiDGBUSResult
    {
        OK,
        MALDGERROR,
        TENLDGERROR,
        DAOERROR


    }

    public class clsLoaiDGBUS
    {
      // Filed
      private clsLoaiDGDAO LoaiDGDAO;
      
      //Contructors
      public clsLoaiDGBUS()
      {
          this.LoaiDGDAO = new clsLoaiDGDAO();
      }

      #region Methods

        public String TimTenLoaiDocGiaTheoMaLDG(String MaLDG)
        {
            return this.LoaiDGDAO.TimTenLoaiDocGiaTheoMaLDG(MaLDG);
        }

        public LoaiDGBUSResult KiemTraRong(clsLoaiDGDTO obj)
        {
            if (obj.MaLDG == "")
                return LoaiDGBUSResult.MALDGERROR;
            if ((obj.TenLDG == ""))
                return LoaiDGBUSResult.TENLDGERROR;
            return LoaiDGBUSResult.OK;
        }

      public DataTable DanhSachLoaiDG()
      {
          return this.LoaiDGDAO.SelectAll();
      }

        public LoaiDGBUSResult ThemLoaiDocGia(clsLoaiDGDTO obj)
      {
          if (!this.LoaiDGDAO .Insert (obj))
              return LoaiDGBUSResult.DAOERROR;
          return LoaiDGBUSResult.OK;
      }

        public LoaiDGBUSResult SuaLoaiDocGia(clsLoaiDGDTO obj)
      {
          if (!this.LoaiDGDAO.Update(obj))
              return LoaiDGBUSResult.DAOERROR;
          return LoaiDGBUSResult.OK;
      }

        public LoaiDGBUSResult XoaLoaiDocGia(clsLoaiDGDTO obj)
      {
          if (!this.LoaiDGDAO.Delete(obj))
              return LoaiDGBUSResult.DAOERROR;
          return LoaiDGBUSResult.OK;
      }


      #endregion


  }
}
